// im注册饼图
var imRegisterPieDom = document.getElementById('im-register-pie-echarts');
var imRegisterPieChart = echarts.init(imRegisterPieDom,'dark');
var imRegisterPieOption;
function initImRegisterPieOption(data){
	 var seriesData = [];
	 if(data.length>0){
		 for (var i = 0; i < data.length; i++) {
			 var item = data[i];
			 var obj = {
				 value:item.imPort,
				 name: item.registerAddress,
				 selected:false
			 }
			 if(i==0){
				 obj.selected = true;
			 }	
			 seriesData.push(obj);
		 }
	 }
			    	 
	 imRegisterPieOption = {
      title: {
        text: 'im注册中心',
        subtext: 'bzm',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
     /*  legend: {
        orient: 'vertical',
        left: 'left'
      }, */
      series: [
        {
          //name: '注册中心',
          type: 'pie',
          radius: '50%',
          data: seriesData,
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    };
    imRegisterPieOption && imRegisterPieChart.setOption(imRegisterPieOption);	
}

// 用户在线  im-user-on-line-pie-echarts
var imUserLineDom = document.getElementById('im-user-line-echarts');
var imUserLineChart = echarts.init(imUserLineDom,'dark');
var imUserLineOption;
function initImUserLineOption(data){
	imUserLineOption = {
	 	  title: {		
		    text: 'im用户数量'
		  },
		  tooltip: {
		    trigger: 'axis'
		  },	
		  /* legend: {
		    data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
		  }, */
		  grid: {
		    left: '3%',
		    right: '4%',
		    bottom: '3%',
		    containLabel: true
		  },
		  /* toolbox: {
		    feature: {
		      saveAsImage: {}
		    }
		  }, */
		  xAxis: {
		    type: 'category',
		    boundaryGap: false,
		    data: data.xaxisData
		  },
		  yAxis: {
		    type: 'value'
		  },	
		  series: [
		    {	
		      name: data.seriesList[0].seriesName,
		      type: 'bar',
		      stack: 'Total',
		      data: data.seriesList[0].seriesData
		    }
		  ]
	};	
	imUserLineOption && imUserLineChart.setOption(imUserLineOption);
}

// im-msg-echarts
var imMsgBarDom = document.getElementById('im-msg-bar-echarts');
var imMsgBarChart = echarts.init(imMsgBarDom,'dark');	
var imMsgBarOption;
function initImMsgBarOption(data){
	imMsgBarOption = {
	 title: {		
	    text: 'im消息数量'
	  },
	  tooltip: {
	    trigger: 'axis'
	  },	
	  xAxis: {
	    type: 'category',
	    boundaryGap: false,
	    data: data.xaxisData
	  },
	  grid: {
	    left: '3%',
	    right: '4%',
	    bottom: '3%',
	    containLabel: true
	  },
	  yAxis: {
	    type: 'value'
	  },
	  series: [	
	    { 
	      name: data.seriesList[0].seriesName,
	      data: data.seriesList[0].seriesData,
	      type: 'line',
	      stack: 'Total'
	    },
	    {	
	      name: data.seriesList[1].seriesName,
	      type: 'line',
	      stack: 'Total',
	      data: data.seriesList[1].seriesData
	    },
	    {	
	      name: data.seriesList[2].seriesName,
	      type: 'line',
	      stack: 'Total',
	      data: data.seriesList[2].seriesData
	    }
	  ]
	};
	imMsgBarOption && imMsgBarChart.setOption(imMsgBarOption);
}